package com.woolink.per.service.stat.dao.impl;

import java.util.List;
import java.util.Map;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.woolink.per.log.syslog.RunLog;
import com.woolink.per.service.stat.dao.StatDataDao;

/**
 * 
 * @author wuliquan
 * @version 2013-12-11
 * @see StatDataDaoImpl
 * @since
 */
public class StatDataDaoImpl extends HibernateDaoSupport implements StatDataDao
{
    private RunLog runLog;
    
    /* (non-Javadoc)
     * @see com.woolink.per.service.stat.dao.StatDataDao#findByProperty(java.lang.Object[])
     */
    public List findByProperty(Map params)
    {
        runLog.info("params="+params);
        
        Query query = getSession().createQuery("from StatData where type = ? and fieldKey > ? and fieldKey < ? ");
        
        query.setString(0, (String)params.get("type"));
        
        query.setString(1, (String)params.get("startDate"));
        
        query.setString(2, (String)params.get("endDate"));
        
        return query.list();
    }
    
    /**
     * @param runLog The runLog to set.
     */
    public void setRunLog(RunLog runLog)
    {
        this.runLog = runLog;
    }
}